<html>
<header>
    <title>执行过程</title>
    <link rel="stylesheet" type="text/css" href="{$INSTALL_CSS}/style.css" />
    <link rel="stylesheet" href="__MODULE__/lib/layui-v2.5.5/css/layui.css" media="all">
    <!--<link rel="stylesheet" type="text/css" href="SHOP_CSS/common.css" />-->
    <!--<script src="__STATIC__/js/jquery-3.1.1.js"></script>-->
    <script src="__STATIC__/plugs/layui-v2.5.6/layui.all.js" charset="utf-8"></script>

    <script language=javascript>
        function s(){
            var c = window.document.body.scrollHeight;
            window.scroll(0,c);
            }
        </script>
</header>
<body onload="s()" style="background-color: #0A0A0A">
<div style="height:100%; color: white" id = 'log'>

 </div>

<script>
    var $;
    layui.use(['layer', 'upload', 'element','jquery'], function() {
        $ = layui.$ //重点处

    });
    //记录上次的执行结果
    var logs = [];

    function myrefresh(){
        $.ajax({
            url: "/install.php/index/process",
            dataType: 'json',
            type: 'post',
            success : function(data) {
                var datas =  data.data.data;
                var code =  data.data.errcode;
                if(code>=0){
                    if(datas.length>logs.length){
                        logs = datas;
                        var html = '';
                        for (var i=0;i<datas.length;i++)
                        {
                            html += ('<div>'+datas[i]+'</div>');
                        }
                        $('#log').html(html);
                        s();
                    }
                }else{
                    //安装完成
                    parent.location.href='/install.php/index/installSuccess';
                }
            }
        })
    }
    setInterval('myrefresh()',300);  //指定1秒刷新一次
</script>
</body>
</html>